package com.xiu.timer;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class TestTimer2 {
	public static void main(String[] args) {
		test1();
	}

	private static void test1() {
		System.out.println("up");
		Timer timer = new Timer();
		timer.schedule(new TimerTask() {
			int count;

			@Override
			public void run() {
				System.out.println("--------"+(new Date()));
			}
		}, 3000, 1000);
		System.out.println("down");
		try {
			Thread.sleep(10000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		timer.cancel();
	}
}
